<template>
	<view>
		<view  class="banner">
			<p style='text-align: center;font-size: 32rpx;'><b>系统公告</b></p>
			
			<view v-for="(item,index) in list" :key="index" @click='detailed(item)'>
				<p  v-if="item.isread == 'false'">
					{{item.title}} <image src="../../static/img/new.svg" style="margin-left: 20rpx;width: 60rpx;vertical-align: bottom;" mode="widthFix"></image>
				</p>
				<p  v-else>
					{{item.title}}
				</p>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				list:[],
				tenancyId:''
			}
		},
		onLoad(options) {
			this.tenancyId = options.tenancyId
		},
		created() {
			let _this = this
			let params = {
				sort:'asc',
				category:'listnotice',
				isread:false,
				pagesize:1000,
				pageindex:1,
				tenancyId:this.tenancyId,
			}
			_this.$lyRequest.get('/gateway/allinoneservice/mp/notice/list.do',
				params
			).then((result)=>{
				if(result.success){
					this.list = result.data.rows
				}else{
					console.log(result.data.msg)
				}
			})
		},
		methods: {
			detailed(item){
				let _this = this
				let params = {
					tenancyId:this.tenancyId
				}
				_this.$lyRequest.get('/gateway/allinoneservice/mp/notice/detail.do/'+item.noticeid+'/0',
					params
				).then((result)=>{
					if(result.success){
						// console.log(result)
					}else{
						console.log(result.data.msg)
					}
				})
				uni.navigateTo({
					url:'./detailed?god='+encodeURIComponent(JSON.stringify(item))
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
.banner{
	margin-top: 20rpx;
	width: 100%;
	padding: 20rpx 0;
	p{
		text-align: left;
		font-size: 28rpx;
		border-bottom: 1px solid #e7e7e7;
		width: 90%;
		margin: 0 auto;
		padding: 20rpx 0;
	}
}
</style>
